<?php
declare (strict_types = 1);

namespace app\admin\controller;

use app\admin\controller\Common;
use think\Request;
use think\facade\View;

class Classs extends Common
{
	/**
	 * 构造方法
	 */
	public function __construct(){
		parent::__construct();
		$this->model = new \app\admin\model\Classs;
		$this->validate = new \app\admin\validate\Classs;

		/**
		 * 标题
		 */
		$this->title = "分类管理";
		View::assign('title',$this->title);

		/**
		 * 模型
		 */
		View::assign('model',$this->model);

		/**
		 * 菜单列表
		 */
		$list = $this->model->level();
		$classs = [];
		get_level($list,$classs,'classs_id',0,'id');
		View::assign('classs',$classs);

		/**
		 * 表结构
		 */
		$this->tables = config('tables.classs');
		View::assign('tables',$this->tables);

		$this->auth_rule = [
			[
				'name'  => "classs/list",
				'title' => "分类-列表",
				'class' => "classs",
			],
			[
				'name'  => "classs/create",
				'title' => "分类-添加",
				'class' => "classs",
			],
			[
				'name'  => "classs/read",
				'title' => "分类-阅读",
				'class' => "classs",
			],
			[
				'name'  => "classs/edit",
				'title' => "分类-修改",
				'class' => "classs",
			],
			[
				'name'  => "classs/delete",
				'title' => "分类-删除",
				'class' => "classs",
			],
		];
	}
	
	/**
	 * 排序
	 */
	protected function order(){
		return "create_time asc,id asc";
	}

    /**
     * 显示资源列表
     *
     * @return \think\Response
     */
    public function index()
    {
		return view('index');
    }
}
